<template>
  <div class="">
    <h6>这是子组件child</h6>
    <button @click="postmsg">要像父组件传值了</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      msg: "这是子组件的msg",
    };
  },
  mounted() {},
  methods: {
    postmsg() {
      this.$emit("aa", this.msg);
    },
    //在子组件点击按钮的时候调用父组件传过来的方法aa
  },
  components: {},
};
</script>

<style lang="scss"></style>
